import request from "@/utils/request";
import {PATH_SYS_DNF} from "@/utils/constant";
import {UserItem} from "@/api/sys/dnf/user-item/types";

const baseUrl = PATH_SYS_DNF + '/user-item/'

/**
 * 查询用户物品列表 - 不带分页
 */
export function getUserItemListApi(): Promise<UserItem[]> {
    return request.get(baseUrl+'list')
}

/**
 * 通过用户物品id获取用户物品信息
 * @param id
 */
export function getUserItemByIdApi(id: number): Promise<UserItem> {
    return request.get(baseUrl + id)
}

/**
 * 修改用户物品
 * @param id
 * @param data
 */
export function editUserItemApi(id: number, data: UserItem): Promise<any> {
    return request.patch(baseUrl + id, data)

}

/**
 * 添加用户物品
 * @param data
 */
export function addUserItemApi(data: UserItem): Promise<any> {
    return request.post(baseUrl, data)
}

/**
 * 删除用户物品
 * @param id
 */
export function deleteUserItemApi(id: number): Promise<any> {
    return request.delete(baseUrl + id)
}